/**
 * 评论模型 
 * 
*/
module.exports = (sequelize, Sequelize) => {
    return sequelize.define("comments", {
        id: {
            type: Sequelize.UUID,
            notNull: true,
            primaryKey: true,
            defaultValue: Sequelize.UUIDV4,
        },
        // articleId: {
        //     type: Sequelize.STRING,
        //     notNull: true,
        //     notEmpty: true,
        //     comment: '文章ID',
        //     // field:'article_id'
        // },
        // article_id: {
        //     type: Sequelize.STRING,
        //     notNull: true,
        //     notEmpty: true,
        //     comment: '文章ID',
        //     // field:'article_id'
        // },
        type: {
            type: Sequelize.INTEGER,
            notNull: true,
            notEmpty: true,
            comment: '评论类别',
        },
        articleTitle: {
            type: Sequelize.STRING,
            notNull: true,
            notEmpty: true,
            comment: '文章标题',
            field:'article_title'
        },
        parentId: {
            type: Sequelize.STRING,
            notNull: true,
            notEmpty: true,
            comment: '父级评论Id',
            field:'parent_id'
        },
        fromUserId: {
            type: Sequelize.STRING,
            notNull: true,
            notEmpty: true,
            comment: '评论用户id',
            field:'from_user_id'
        },
        fromNickname: {
            type: Sequelize.STRING,
            notNull: true,
            notEmpty: true,
            comment: '评论用户昵称',
            field:'from_nickname'
        },
        fromAvatar: {
            type: Sequelize.TEXT("long"),
            notNull: true,
            notEmpty: true,
            comment: '评论用户头像',
            field:'from_avatar'
        },
        toUserId: {
            type: Sequelize.STRING,
            notNull: true,
            notEmpty: true,
            comment: '回复评论用户Id',
            field:'to_user_id'
        },
        toNickname: {
            type: Sequelize.STRING,
            notNull: true,
            notEmpty: true,
            comment: '回复评论名称',
            field: 'to_nickname'
        },
        toAvatar: {
            type: Sequelize.TEXT("long"),
            notNull: true,
            notEmpty: true,
            comment: '回复评论用户头像',
            field:'to_avatar'
        },
        toId: {
            type: Sequelize.STRING,
            notNull: true,
            notEmpty: true,
            comment: '回复的主键评论id',
            field:'to_id'
        },
        toUserKeyId: {
            type: Sequelize.STRING,
            notNull: true,
            notEmpty: true,
            comment: '回复的用户主键id',
            field:'to_user_key_id'
        },
        content: {
            type: Sequelize.TEXT("long"),
            comment: '评论内容',
        }
    })
}